package com.yan.design.two.structure.s3;


/**
 * 3. 装饰者模式
 *      （配料类 - 布丁B类）装饰类 -  实现类
 * @author shengren.yan
 * @create 2022-07-27
 */
public class BDecoratorImpl extends Decorator{

    private static final int COST = 8;

    private final Base base;

    public BDecoratorImpl(Base b){
        this.base = b;
    }

    @Override
    public int cost() {
        System.out.println(" 布丁B类 = " + COST);
        return base.cost() + COST;
    }

}
